import Main from "../view/Main/main"
import Home from "../view/Main/Home/Home"
import Classify from "../view/Main/classify/classify"
import Vip from "../view/Main/vip/vip"
import Cart from "../view/Main/cart/Cart"
import My from "../view/Main/my/My"
import Detail from "../view/Detail/Detail"
//路由的接口的规范
interface Item{
    tit?:string,
    path:string,
    component?:any,
    redirect?:any
}
//继承路由接口的 规范 并添加 children 继承与Item的属性
export interface RouterItem extends Item{
    children? : Item[]
}
let routes:RouterItem[] = [
    {
        path:"/main",
        component:Main,
        children:[
            {
                tit:"首页",
                path:"/main/home",
                component:Home,
            },
            {
                tit:"派送",
                path:"/main/classify",
                component:Classify
            },
            {
                tit:"vip",
                path:"/main/vip",
                component:Vip
            },
            {
                tit:"购物车",
                path:"/main/cart",
                component:Cart
            },
            {
                tit:"我的",
                path:"/main/my",
                component:My
            },
            {
                path:"/main",
                redirect:"/main/home"
            }
        ]
    },
    {
        path:"/detail",
        component:Detail
    },
    {
        path:"/",
        redirect:"/main"
    }
]

export default routes